package pl.edu.utp.kursy.database;

import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "companies")
public class Company extends BaseId{
    
    @Column(name = "name")
    private String name;
    
    @Column(name="address")
    private String address;
    
    @Column(name = "zip_code")
    private String zipCode;
    
    @Column(name="city")
    private String city;
    
    @Column(name="phone")
    private String phone;
    
    @Column(name="fax")
    private String fax;
    
    @Column(name="email")
    private String email;
    
    @Column(name="nip")
    private String nip;
    
    @Column(name="regon")
    private String regon;
        
    @OneToMany(fetch = FetchType.EAGER, mappedBy = "company",cascade = CascadeType.REMOVE)
    private Set<Worker> workers;
    
    @ManyToMany(fetch = FetchType.EAGER, mappedBy = "companies")
    private Set<CourseEvent> courseEvents;
    
    @OneToMany(fetch = FetchType.EAGER, mappedBy = "company", cascade = CascadeType.REMOVE)
    private Set<CourseEventCompanyAccomodation> courseEventsCompanyAccomodation;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getZipCode() {
        return zipCode;
    }

    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getFax() {
        return fax;
    }

    public void setFax(String fax) {
        this.fax = fax;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getNip() {
        return nip;
    }

    public void setNip(String nip) {
        this.nip = nip;
    }

    public String getRegon() {
        return regon;
    }

    public void setRegon(String regon) {
        this.regon = regon;
    }

    public Set<Worker> getWorkers() {
        return workers;
    }

    public void setWorkers(Set<Worker> workers) {
        this.workers = workers;
    }

    public Set<CourseEvent> getCourseEvents() {
        return courseEvents;
    }

    public void setCourseEvents(Set<CourseEvent> courseEvents) {
        this.courseEvents = courseEvents;
    }

    public Set<CourseEventCompanyAccomodation> getCourseEventsCompanyAccomodation() {
        return courseEventsCompanyAccomodation;
    }

    public void setCourseEventsCompanyAccomodation(Set<CourseEventCompanyAccomodation> courseEventsCompanyAccomodation) {
        this.courseEventsCompanyAccomodation = courseEventsCompanyAccomodation;
    }
    
    @Override
    public String toString() {
        return getName();
    }
}
